<template>
  <div>
    <home-header :city="city"></home-header>
    <home-swiper :imglist="imglist"></home-swiper>
    <home-icons :iconslist="iconslist"></home-icons>
    <home-hot :hotGoods="hotGoods"></home-hot>
    <home-like :likeGoods="likeGoods"></home-like>
    <home-weekend :weekendGoods="weekendGoods"></home-weekend>
    <home-footer></home-footer>
  </div>
</template>

<script>
import homeHeader from "./components/header";
import homeSwiper from "./components/swiper";
import homeIcons from "./components/icons";
import homeHot from './components/hot'
import homeLike from './components/like'
import homeFooter from './components/footer'
import homeWeekend from './components/weekend'

import axios from "axios";
export default {
  name: "Home",
  data() {
    return {
      imglist: [],
      iconslist:[],
      hotGoods:[],
      likeGoods:[],
      weekendGoods:[],
      city:""
    };
  },
  components: {
    homeHeader,
    homeSwiper,
    homeIcons,
    homeHot,
    homeLike,
    homeWeekend,
    homeFooter
  },
  methods: {
    getHomeInfo() {
      axios.get("/api/index.json").then(this.getHomeInfoSucc);
    },
    getHomeInfoSucc(res) {
     
      res = res.data;
      if(res.ret&&res.data){
          const data=res.data;
          this.imglist=data.imglist;
          this.iconslist=data.iconslist;
          this.hotGoods=data.hotGoods;
          this.likeGoods=data.likeGoods;
          this.weekendGoods=data.weekendGoods;
          this.city=data.city;
      }
    }
  },
  mounted(){
      this.getHomeInfo();
  }
};
</script>

<style scoped>
</style>